import request from '@/router/axios'
import {getSCOrLCOrACC, qianxiangType} from "../../../commonCheck";

/**
 * itvm ITVM电子层级差异待协查
 * @param query
 */
export function getSwAuItvmOnlineAmountHierarchyDifferenceList(query) {
  return request({
    url: '/check/check/getSwAuItvmOnlineAmountHierarchyDifferenceList',
    method: 'post',
    params: query
  })
}

/**
 * 替换itvm的内容
 */
export function replaceSwAuItvmOnlineAmountHierarchyDifference(query){
  return request({
    url: '/check/check/replaceSwAuItvmOnlineAmountHierarchyDifference',
    method: 'post',
    params: query
  })
}

/**
 * itvm下发
 */
export function sendStatusSwAuItvmOnlineAmountHierarchyDifference(query){
  return request({
    url: '/check/check/sendStatusSwAuItvmOnlineAmountHierarchyDifference',
    method: 'post',
    data: query
    //params: query
  })
}

export function getMondifyData1(ob){
  console.log(ob)
  let one={};
  let two={};
  if(ob.compareType==3){ //SC与LC
    one.type="SC";
    two.type="LC";
  }else if(ob.compareType==4){//LC与ACC
    one.type="LC";
    two.type="ACC";
  }

  one.saleAmount=ob.saleAmount;
  one.saleAmountCY='';
  one.depositAmount=ob.depositAmount;
  one.depositAmountCY='';
  one.errorRefundAmount=ob.errorRefundAmount;
  one.errorRefundAmountCY='';
  one.sumCY='';

  two.saleAmount=ob.beSaleAmount;
  two.saleAmountCY=ob.saleAmount-ob.beSaleAmount;
  two.depositAmount=ob.beDepositAmount;
  two.depositAmountCY=ob.depositAmount-ob.beDepositAmount;
  two.errorRefundAmount=ob.beErrorRefundAmount;
  two.errorRefundAmountCY=ob.errorRefundAmount-ob.beErrorRefundAmount;
  two.sumCY=(ob.saleAmount-ob.beSaleAmount)+(ob.depositAmount-ob.beDepositAmount)-(ob.errorRefundAmount-ob.beErrorRefundAmount);


  // one.type="结账单据";
  // one.saleAmount=ob.tvmBillCashSellTicket;
  // one.saleAmountCY='';
  // one.depositAmount=ob.tvmBillCashRecharge;
  // one.depositAmountCY='';
  // one.errorRefundAmount=ob.tvmBillCashReturn;
  // one.errorRefundAmountCY='';
  // one.sumCY='';

  // two.type=getSCOrLCOrACC(ob.compareType);
  // two.saleAmount=ob.beSaleAmount;
  // two.saleAmountCY=ob.beSaleAmount-ob.tvmBillCashSellTicket;
  // two.depositAmount=ob.beDepositAmount;
  // two.depositAmountCY=ob.beDepositAmount-ob.tvmBillCashRecharge;
  // two.errorRefundAmount=ob.beErrorRefundAmount;
  // two.errorRefundAmountCY=ob.beErrorRefundAmount-ob.tvmBillCashReturn;
  // two.sumCY=(ob.beSaleAmount-ob.tvmBillCashSellTicket)+(ob.beDepositAmount-ob.tvmBillCashRecharge)-(ob.beErrorRefundAmount-ob.tvmBillCashReturn);

  let res=[];
  res.push(one);
  res.push(two);
  return res;
}

export const cols1=[{
  label: '系统层级',
  prop: "type",
  formslot: true,
},
  {
    label: '售卖金额',
    prop: "saleAmount",
    formslot: true,
  },
  {
    width:120,
    label: '售卖差异金额',
    prop: "saleAmountCY",
    formslot: true,
  },
  {
    label: '充值金额',
    prop: "depositAmount",
    formslot: true,
  },
  {
    width:120,
    label: '充值差异金额',
    prop: "depositAmountCY",
    formslot: true,
  },
  {
    label: '退款金额',
    prop: "errorRefundAmount",
    formslot: true,
  },

  {
    width:120,
    label: '退款差异金额',
    prop: "errorRefundAmountCY",
    formslot: true,
  },
  {
    width:120,
    label: '票款合计差异',
    prop: "sumCY",
    formslot: true,
  }]


export function getMondifyData2(ob){
  let res=[];
  let one={};
  let two={};

  if(ob.compareType==3){ //SC与LC
    one.type="SC";

    one.beSaleAmount=ob.saleAmount;
    one.replySaleMoney=ob.replySaleMoney;
    one.replySaleMoneyCY=ob.saleAmount-ob.replySaleMoney;
  
    one.beDepositAmount=ob.depositAmount;
    one.replyRechargeMoney=ob.replyRechargeMoney;
    one.replyRechargeMoneyCY=ob.depositAmount-ob.replyRechargeMoney;
  
    one.beErrorRefundAmount=ob.errorRefundAmount;
    one.replyErrorReturnMoney=ob.replyErrorReturnMoney;
    one.replyErrorReturnMoneyCY=ob.errorRefundAmount-ob.replyErrorReturnMoney;
  
    one.sumCY=one.replySaleMoneyCY+one.replyRechargeMoneyCY-one.replyErrorReturnMoneyCY;

  }else if(ob.compareType==4){//LC与ACC
    one.type="LC";
    two.type="ACC";

    one.beSaleAmount=ob.saleAmount;
    one.replySaleMoney=ob.replySaleMoney;
    one.replySaleMoneyCY="";
  
    one.beDepositAmount=ob.depositAmount;
    one.replyRechargeMoney=ob.replyRechargeMoney;
    one.replyRechargeMoneyCY="";
  
    one.beErrorRefundAmount=ob.errorRefundAmount;
    one.replyErrorReturnMoney=ob.replyErrorReturnMoney;
    one.replyErrorReturnMoneyCY="";
  
    one.sumCY="";
  
    two.beSaleAmount=ob.beSaleAmount;
    two.replySaleMoney=ob.replyComparativeSaleMoney;
    two.replySaleMoneyCY=ob.replySaleMoney-ob.replyComparativeSaleMoney;
  
    two.beDepositAmount=ob.beDepositAmount;
    two.replyRechargeMoney=ob.replyComparativeRechargeMoney;
    two.replyRechargeMoneyCY=ob.replyRechargeMoney-ob.replyComparativeRechargeMoney;
  
    two.beErrorRefundAmount=ob.beErrorRefundAmount;
    two.replyErrorReturnMoney=ob.replyComparativeErrorReturnMoney;
    two.replyErrorReturnMoneyCY=ob.replyErrorReturnMoney-ob.replyComparativeErrorReturnMoney;
  
    two.sumCY=two.replySaleMoneyCY+two.replyRechargeMoneyCY-two.replyErrorReturnMoneyCY;
  }

  // one.type="结账单据";
  // one.beSaleAmount=ob.tvmBillCashSellTicket;
  // one.replySaleMoney='';
  // one.replySaleMoneyCY='';

  // one.beDepositAmount=ob.tvmBillCashRecharge;
  // one.replyRechargeMoney='';
  // one.replyRechargeMoneyCY='';

  // one.beErrorRefundAmount=ob.tvmBillCashReturn;
  // one.replyErrorReturnMoney='';
  // one.replyErrorReturnMoneyCY='';

  // one.sumCY='';

  // two.type=getSCOrLCOrACC(ob.compareType);
  // two.beSaleAmount=ob.beSaleAmount;
  // two.replySaleMoney=ob.replySaleMoney;
  // two.replySaleMoneyCY=ob.replySaleMoney-ob.tvmBillCashSellTicket;

  // two.beDepositAmount=ob.beDepositAmount;
  // two.replyRechargeMoney=ob.replyRechargeMoney;
  // two.replyRechargeMoneyCY=ob.replyRechargeMoney-ob.tvmBillCashRecharge;

  // two.beErrorRefundAmount=ob.beErrorRefundAmount;
  // two.replyErrorReturnMoney=ob.replyErrorReturnMoney;
  // two.replyErrorReturnMoneyCY=ob.replyErrorReturnMoney-ob.tvmBillCashReturn;

  // two.sumCY=(ob.replySaleMoney-ob.tvmBillCashSellTicket)+(ob.replyRechargeMoney-ob.tvmBillCashRecharge)-(ob.replyErrorReturnMoney-ob.tvmBillCashReturn);
  
  if(ob.compareType==3){//SC与LC
    res.push(one);
  }else{
    res.push(one);
    res.push(two);
  } 
  return res;
}

export const cols2=[{
  label: '系统层级',
  prop: "type",
  formslot: true,
},
  {
    label: '售卖金额',
    prop: "beSaleAmount",
    formslot: true,
  },
  {
    width:120,
    label: '回馈售卖金额',
    prop: "replySaleMoney",
    formslot: true,
  },
  {
    width:140,
    label: '回馈后售卖差异',
    prop: "replySaleMoneyCY",
    formslot: true,
  },
  {
    label: '充值金额',
    prop: "beDepositAmount",
    formslot: true,
  },
  {
    width:120,
    label: '回馈充值金额',
    prop: "replyRechargeMoney",
    formslot: true,
  },

  {
    width:140,
    label: '回馈后充值差异',
    prop: "replyRechargeMoneyCY",
    formslot: true,
  },
  {
    label: '退款金额',
    prop: "beErrorRefundAmount",
    formslot: true,
  },
  {
    width:120,
    label: '回馈退款金额',
    prop: "replyErrorReturnMoney",
    formslot: true,
  },
  {
    width:140,
    label: '回馈后退款差异',
    prop: "replyErrorReturnMoneyCY",
    formslot: true,
  },
  {
    width:180,
    label: '回馈后票款合计差异',
    prop: "sumCY",
    formslot: true
  }]
